﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TL_Cloud.Core.Entities;

namespace TL_Cloud.Models.BookShop
{
    public partial class Base_GradeInfo : BaseEntity
    {
        public string GradeId { get; set; }
        public string GradeName { get; set; }
        public int? Sort { get; set; } 
        public string CreateUserId { get; set; }
        public string CreateUserName { get; set; }
        public DateTime? ModifyDate { get; set; }
        public string ModifyUserId { get; set; }
        public string ModifyUserName { get; set; }
        public string ManagerId { get; set; }
        public int? EnabledMark { get; set; }
        public int? DeleteMark { get; set; }

        public override void Create(string userId,string userName)
        {
            this.GradeId = Guid.NewGuid().ToString();
            this.CreateDate = DateTime.Now;
            this.EnabledMark = 1;
            this.DeleteMark = 0;
            this.CreateUserId = userId;
            this.CreateUserName = userName;
        }

        public override void Modify(string userId, string userName)
        {
            this.ModifyDate = DateTime.Now;
            this.ModifyUserId = userId;
            this.ModifyUserName = userName;
        }

        public override void Mapping(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Base_GradeInfo>(entity =>
            {
                entity.HasKey(e => e.GradeId);

                entity.ToTable("Base_GradeInfo");

                entity.Property(e => e.GradeId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .ValueGeneratedNever();

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.CreateUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateUserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.GradeName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyDate).HasColumnType("datetime");

                entity.Property(e => e.ModifyUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyUserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });
        }
    }
}
